<?php
function checkurl(){ 

	  //如果直接从浏览器连接到页面，就连接到登陆窗口 
	  //echo "referer:".$_SESSION['HTTP_REFERER']; 
	  if(!isset($_SESSION['HTTP_REFERER'])) { 
		  header("location: login"); 
		  exit; 
	  } 

	  $urlar = parse_url($_SESSION['HTTP_REFERER']); 

	  //如果页面的域名不是服务器域名,就连接到登陆窗口 
	  if($_SERVER['HTTP_HOST'] != $urlar["host"] && $urlar["host"] != "202.102.110.204" && $urlar["host"] != "http://blog.163.com/fantasy_lxh/") { 
		  header("location: login.php"); 
		  exit; 
	  }
} 
checkurl();
?>